const mongoose = require('mongoose')
const Schema = mongoose.Schema
const VoteSchemaConfig = {
  versionKey: false,
  timestamps: {
    createdAt: 'created_at',
    updatedAt: false
  },
  typeKey: '$type'
}

const VoteSchema = new Schema({
  team: { $type: Schema.Types.ObjectId, ref: 'Team' },
  title: String,
  type: Number,
  options: [String],
  secret: { $type: Boolean, default: false }
}, VoteSchemaConfig)

exports = module.exports = VoteSchema
